package edu.whut.mall.portal.service;

import edu.whut.mall.common.api.CommonResult;
import edu.whut.mall.model.PayInfo;
import edu.whut.mall.portal.domain.PayInfoParams;

import javax.servlet.http.HttpServletRequest;
import java.security.NoSuchAlgorithmException;

/**
* @program: d9lab-mall
* @description: 支付信息功能接口
* @author:  Wayne
* @create: 2020-05-22 16:16:25
**/

public interface IPayInfoService {
    /**
     * 发起支付
     * @param payInfoParams
     * @return
     */
    CommonResult Create(PayInfoParams payInfoParams) throws NoSuchAlgorithmException;

    /**
     * 异步回调
     * @param request
     * @return
     */
    String asyncNotify(HttpServletRequest request) throws NoSuchAlgorithmException;

    /**
     * 根据订单编号查询订单
     * @param orderNo
     * @return
     */
    PayInfo queryPayInfoByOrderNo(String orderNo);

    /**
     * 根据订单号来退款
     * @param orderNo 订单号
     * @return 退款结果
     */
    CommonResult refund(String orderNo) throws NoSuchAlgorithmException;

    /**
     * 更新订单状态
     * @param orderNo
     * @param orderStatusCode
     */
    void updateGroupBuyOrderStatus(String orderNo, Integer orderStatusCode);

    /**
     * 更新支付状态
     * @param orderNo
     * @param PaymentStatusCode
     */
    void updatePayInfoStatus(String orderNo, Integer PaymentStatusCode);

    /**
     * 申请退款
     * @param orderNo
     * @return
     */
    Integer requestFund(String orderNo, String reason);


}